<SCRIPT type="text/javascript">
	function pannelMgr(id){
		$("#main_pannel_ul>li").attr("class","nav_tapIthems");
		$("#mainDiv>div").css("display","none");
		$("#"+id+"_div").css("display","block");
		$("#"+id+"_li").addClass("cur");
	}
	
	//选择用户
	$("#newreport").on("click",function(){
		pannelMgr('authselect');
		//绑定提交权限,用户和组织append到权限中
		$("#btnSubmit").click(function(){
			
			var userids ="";
			$("div#authselect_div input:checkbox[name='userownerids']:checked").each(function(index, element) {
				if(userids.length!=0){
					userids +=",";
				}
				userids += this.value;
			});
			var roleids = "";
			var checkeds = ztree.getCheckedNodes();
			for(var i=0;i<checkeds.length;i++){
				if(checkeds[i].id&&checkeds[i].id != "0"){
					roleids += checkeds[i].id+",";
				}
			}
			loadURL("/${orgi}/user/report/${tabid}/${dicid!''}/${dicid}/roleditdo.html?isDic=1&isReport=1&userids="+userids+"&roleids="+roleids,".d-content",function(){
				pannelMgr('level');
			});	
			return false;
		});
		
		$("#btnCancel").click(function(){
			pannelMgr('level');
			return false;
		});
		
	});

	function selUserGroupclose(){
		var subVal = "" ;
		$('input[name="userid"]:checked').each(function(){
			if(subVal!=""){
				subVal += "," ;
			}
			subVal += $(this).val();
		}); 
		loadURL('/${orgi}/user/report/${tabid}/authorize.html?reportid=${dicid!""}&dicid=${dicid!''}&ownertype=5&authexpress='+encodeURIComponent(subVal),'#perdiv' , function(){
			 var dialog = art.dialog({id: 'selUserGroup',title: false});
			dialog.close();
		})	; 		
	}
	function openUserGroup(){
		var userDialog = art.dialog({
		    title: '选择用户',
		    id:'selUserGroup',
		    content: '<div id ="userDialog" class="conTop" style="padding:0;margin:0"><img src="/assets/images/loading.png" width="35" height="35" alt=""><h2>页面正在载入，请稍候......</h2></div>',
		    width: 350,
		    padding:'0',
		    initialize: function () {
		    	var currentDialog = this;
				$.ajax({
					url:"/${orgi}/user/report/${tabid}/organ/selUser.html?sub=true",
					cache:false,
					success: function(data){
						$("#userDialog").empty().html(data);
						//userDialog.content(data);
					},
					error:  function(xhr, type, s){	
						if(xhr.getResponseHeader("emsg")){
							art.alert(xhr.getResponseHeader("emsg"));
						}
					}
				}).done(function(){
				});
		    	//loadURL("/${orgi}/user/report/${tabid}/role/selUser.html" , "#tempdiv" , function(){} );
		    }
		});
	}
	
</SCRIPT>
<div class="artCon">
	<div class="middleArt">
	<form class="form-horizontal" id="mainForm" action="/${orgi}/user/report/${tabid}/${dicid!''}/reportdicedito.html" data-toggle="form" method="post">
		<input type="hidden" value="${dicInfo.id}" name="id"/>
		<div class="artMain">
			<div class="rs_layout">
				<div class="rs_layout_top">
					<ul id="main_pannel_ul" class="nav_tapWrap">
						<#if dicInfo.authList??>
							<!-- 1读/2编辑/3设置策略/4设计/5执行/6遍历 -->
							<li id="proper_li" onclick="pannelMgr('proper')" class="nav_tapIthems cur">基本信息</li>
							<#if dicInfo.isAllow('0',user) == true >
								<li id="level_li" onclick="pannelMgr('level')" class="nav_tapIthems">权限</li>
							</#if>
						</#if>
					</ul>
				</div>
			</div>
			<div id="mainDiv" class="rs_layout_center">
				<div id="proper_div" style="padding:10px;">
					<table class="data_table_1">
						<tr>
							<th>目录名称：</th>
							<td>
							<#if dicInfo.id!='0'>
								<input name="name" type="text" minlength="3" class="span2 required" value="${dicInfo.name!''}">
								<span class="help-inline"></span><i class="inputip">*</i>
							<#else>
								${dicInfo.name!''}
							</#if>
							
							</td>
							<#if dicInfo.id!='0'>
								<th>创建时间：</th>
								<td><#if dicInfo.createtime??>${dicInfo.createtime?string("yyyy-MM-dd HH:mm:ss")}</#if></td>
							</#if>
						</tr>
						<tr>
							<th>目录类型：</th>
							<td>
							<#if dicInfo.tabtype=='pub'>公共文件夹<#else>个人文件夹</#if>
							</td>
							<#if dicInfo.parentid=='0'>
								<th>所属目录：</th>
								<td>公共文件夹</td>
							</#if>
						</tr>
						<tr>
							<th style="vertical-align:top; padding-top:20px; padding-bottom:20px; line-height:42px; border-top: dashed 1px #ccc">目录描述：</th>
							<td style=" padding-top:10px; padding-bottom:10px; border-top: dashed 1px #ccc;" colspan="3"><textarea name="description" style="width:100%; height:80px; resize:none;" id="" cols="30" rows="10">${dicInfo.description!''}</textarea></td>
						</tr>
					</table>
				</div>
				
				<div id="level_div" style="padding:10px;min-height:130px; display: none;">
					<p>指定报表或目录的访问权限。默认情况下，报表或目录从上级目录继承访问权限。您可以使用为此配置</p>
					<div class="check_top">
						  <p><label>
						  	<input type="checkbox" name="type" value="true" <#if dicInfo.type?? && dicInfo.type == 'true'>checked="checked"</#if>/>覆盖从父条目继承的访问权限  
						  	<i class="tbControlIcon icons_user" style="padding-top: 4px;"></i>
						  	<a title="添加授权对象" href="javascript:openUserGroup()">选择组或用户</a>
						  </label>  </p>
					</div>
					<div style="width: 100%;height:280px;">
						<div class="tableScrollWrap" style="width:100%;overflow-x:hidden;">
							<div class="check_box_con" style="width:100%;margin-left:0px;" id="perdiv">
								<#include "dicauthorize.html"/>
							</div>
						</div>
				    </div>
				</div>
			</div>
			
		</div>
		
		<div class="bottomBg">
			<div class="btnWrap">
				<input type="submit" class="subButtonStyle" value="确认"/>
				<input type="button" onclick="closeR3ArtDialog()" class="cancelButtonStyle" value="取消"/>
			</div>
		</div>
	</form>
	</div>
</div>
